package cn.tedu.micro.demo.order.controller;

import cn.tedu.micro.demo.common.pojo.dto.OrderCreateParam;
import cn.tedu.micro.demo.common.pojo.protocol.JsonResult;
import cn.tedu.micro.demo.order.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class OrderController {
    @Autowired
    private OrderService orderService;

    @PostMapping("/order/create")
    public JsonResult<String> create(Integer gunId,Integer userId) {
        log.debug("控制层，创建订单：gunId={},userId={}", gunId,userId);
        String billId = orderService.create(gunId,userId);
        return JsonResult.ok("订单创建成功！订单号：" + billId);
    }
}
